package com.example.android.services

import android.util.Log
import com.example.android.extensions.StringBody
import com.example.android.models.Announce
import com.example.android.models.SelfInfo
import com.example.android.utils.Api
import com.example.android.utils.JsonUtil
import com.example.android.utils.models.Form
import com.example.android.utils.models.MyResult


/**
 *
 * @Author lxy
 * @Date 2022/6/1
 *
 **/

class InfoService(private val _Api: Api,private val _JsonUtil: JsonUtil,private val _HashMapStorage: HashMap<String, String>) {
    suspend fun AddSelfInfo(photoList: ArrayList<SelfInfo>): MyResult<Unit> {
        val resJson = _Api.Get("/user-photo/get-photo-by-name").StringBody()
        Log.d(toString(), resJson)

        val result = _JsonUtil.FromJsonObject(resJson).AsMyResult<ArrayList<Form>>()

        result.Data?.forEach {
//            photoList.add(SelfInfo(it["name"] as String,it["sex"] as String,it["birth"] as Int,it["id"] as Int,it["phpne"] as Int,
//                it["number"] as Int,it["grade"] as String,it["en_year"] as Int,it["gra_year"] as Int,it["poli_status"] as String,
//                it["college"] as String,it["major"] as String,it["s_class"] as String,it["diffi_apply"] as String,it["type"] as String,
//                it["address"] as String))
        }

        return MyResult(MyResult.OK, result.Message)
    }
}



















